<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>window.enablePixelTesting = true;</script>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/text-based-repaint.js"></script>
</head>
<body style="margin: 0px" onload="runRepaintAndPixelTest()">

<script type="text/javascript">
    window.outputRepaintRects = false;
    function test1() {
        object1 = document.getElementsByTagName("object")[0];
        debug("Check initial &lt;object&gt; size, before external resource loaded");

        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "300px");
        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "150px");
    }

    function repaintTest() {
        object1 = document.getElementsByTagName("object")[0];

        debug("");
        debug("Check initial &lt;object&gt; size, after external resource loaded");
        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "200px");
        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");

        setTimeout(function() {
            var svgDoc = object1.getSVGDocument();
            var svgWindow = svgDoc.defaultView;
            svgWindow.changeSize();
            test3();
        }, 0);
    }

    function test3() {
        object1 = document.getElementsByTagName("object")[0];

        debug("");
        debug("Check final &lt;object&gt; size, after resizing finished");
        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).width", "400px");
        shouldBeEqualToString("document.defaultView.getComputedStyle(object1).height", "200px");

        debug("");
        debug("Test passed if you see two green rectangles");

        finishJSTest();
    }
</script>

<object style="border: 1px red solid" data="resources/embedded-svg-size-changes.svg"></object>
<p id="description"></p>
<div id="console"></div>

<script>
    window.jsTestIsAsync = true;
    if (window.testRunner)
        testRunner.waitUntilDone();
    description("This test checks that intrinsic size changes of an embedded SVG cause immediate updates of the object that embeds it.");
    test1();
</script>
</body>
</html>
